//
//  MaineJournalAppDelegate.h
//  MaineJournal
//
//  Created by Administrator on 8/15/11.
//  Copyright 2011 University of Maine. All rights reserved.
//

#import <pthread.h>

#import "GridView.h"
#import "Library.h"

@interface LibraryViewController : UIViewController <UINavigationBarDelegate, GridViewDelegate, LibraryUpdaterDelegate> {
@private
  GridView* _gridView;
  UINavigationBar* _navigationBar;
  UISegmentedControl* _segmentedControl;
  UIView* _menuView;
  UIProgressView* _progressView;
  UIButton* _updateButton;
  UIButton* _forceUpdateButton;
  UIButton* _markReadButton;
  UIButton* _markNewButton;
  UISwitch* _serverSwitch;
  UILabel* _addressLabel;
  UILabel* _passwordLabel;
  UILabel* _infoLabel;
  UILabel* _versionLabel;
  UIWindow* _window;
  
  BOOL _launched;
  UIImage* _collectionImage;
  UIImage* _newImage;
  UIImage* _ribbonImage;
  UIImage* _comicImage;
  UIPopoverController* _menuController;
  Collection* _currentCollection;
  Comic* _currentComic;
  DatabaseObject* _selectedItem;
  UIImageView* _launchView;
#if __DISPLAY_THUMBNAILS_IN_BACKGROUND__
  pthread_mutex_t _displayMutex;
  CFMutableArrayRef _displayQueue;
  CFRunLoopSourceRef _displaySource;
  CFRunLoopRef _displayRunLoop;
  CFMutableDictionaryRef _showBatch;
  CFMutableSetRef _hideBatch;
#if __STORE_THUMBNAILS_IN_DATABASE__
  LibraryConnection* _displayConnection;
#endif
#endif
}
@property(nonatomic, retain) IBOutlet GridView* gridView;
@property(nonatomic, retain) IBOutlet UINavigationBar* navigationBar;
@property(nonatomic, retain) IBOutlet UISegmentedControl* segmentedControl;
@property(nonatomic, retain) IBOutlet UIView* menuView;
@property(nonatomic, retain) IBOutlet UIProgressView* progressView;
@property(nonatomic, retain) IBOutlet UIButton* updateButton;
@property(nonatomic, retain) IBOutlet UIButton* forceUpdateButton;
@property(nonatomic, retain) IBOutlet UIButton* markReadButton;
@property(nonatomic, retain) IBOutlet UIButton* markNewButton;
@property(nonatomic, retain) IBOutlet UISwitch* serverSwitch;
@property(nonatomic, retain) IBOutlet UILabel* addressLabel;
@property(nonatomic, retain) IBOutlet UILabel* passwordLabel;
@property(nonatomic, retain) IBOutlet UILabel* infoLabel;
@property(nonatomic, retain) IBOutlet UILabel* versionLabel;
@property(nonatomic, assign) UIWindow* window;
- (void) saveState;
@end

@interface LibraryViewController (IBActions)
- (IBAction) resort:(id)sender;
- (IBAction) update:(id)sender;
- (IBAction) forceUpdate:(id)sender;
- (IBAction) updateServer:(id)sender;
- (IBAction) markAllRead:(id)sender;
- (IBAction) markAllNew:(id)sender;
- (IBAction) showLog:(id)sender;
@end
